//
//  BaseNavigationController.m
//  JJHW_coreData
//
//  Created by lizhenqiang on 16/4/2.
//  Copyright © 2016年 HFKJ_LZQ. All rights reserved.
//

#import "BaseNavigationController.h"

#define  kNavTitleFont 17.0

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController

+ (void)initialize
{
    if (self == [BaseNavigationController class])
    {
        // 1.设置全局导航条外观
        [self setupNav];
    }
}

#pragma mark - 设置全局导航条
+ (void)setupNav
{
    UINavigationBar * navBar = [UINavigationBar appearance];
    //    [navBar setBackgroundImage:[UIImage imageWithColor:[UIColor colorWithHexString:@"0x28303b"]] forBarMetrics:UIBarMetricsDefault];
    //    [navBar setTintColor:[UIColor whiteColor]];                                      //返回按钮的箭头颜色
    [navBar setBarTintColor:NavBarBJColor];
    [navBar setBackgroundImage:[UIImage imageWithColor:NavBarBJColor] forBarMetrics:UIBarMetricsDefault];
    [navBar setTintColor:[UIColor whiteColor]];//改变的是 navigationcontroller的左右两边navigation item的color
    NSDictionary *textAttributes = @{
                                     NSFontAttributeName: [UIFont boldSystemFontOfSize:kNavTitleFont],
                                     NSForegroundColorAttributeName: [UIColor whiteColor],
                                     };//改变的是 navigationcontroller的title的color
    [navBar setTitleTextAttributes:textAttributes];
    
    //    [[UITextField appearance] setTintColor:[UIColor colorWithHexString:@"0x3bbc79"]]; //设置UITextField的光标颜色
    //    [[UITextView appearance] setTintColor:[UIColor colorWithHexString:@"0x3bbc79"]];  //设置UITextView的光标颜色
    //    [[UISearchBar appearance] setBackgroundImage:[UIImage imageWithColor:kColorTableSectionBg] forBarPosition:0 barMetrics:UIBarMetricsDefault];
    
    [[UITextField appearance] setTintColor:[UIColor whiteColor]]; //设置UITextField的光标颜色
    [[UITextView appearance] setTintColor:[UIColor whiteColor]];  //设置UITextView的光标颜色
    [[UISearchBar appearance] setBackgroundImage:[UIImage imageWithColor:[UIColor grayColor]] forBarPosition:0 barMetrics:UIBarMetricsDefault];
}

//- (BOOL)shouldAutorotate
//{
//    return [self.visibleViewController shouldAutorotate];
//}
//
//- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
//{
//    return [self.visibleViewController preferredInterfaceOrientationForPresentation];
//}
//
//- (UIInterfaceOrientationMask)supportedInterfaceOrientations
//{
//    if (![self.visibleViewController isKindOfClass:[UIAlertController class]])
//    {   //iOS9 UIWebRotatingAlertController
//        return [self.visibleViewController supportedInterfaceOrientations];
//    }
//    else
//    {
//        return UIInterfaceOrientationMaskPortrait;
//    }
//}
//
//- (UIStatusBarStyle)preferredStatusBarStyle
//{
//    return UIStatusBarStyleLightContent;
//}


@end
